package com.ksyun.campus.client.domain;

public class DataServerMsg{
    private String host;
    private int port;
    private int fileTotal;
    private int capacity;
    private int useCapacity;
    
    // 添加实际JSON中存在的字段
    private String ip;
    private long usedCapacity;
    private long totalCapacity;
    private int fileNum;
    
    // 根据错误信息中的JSON添加更多字段
    private String dsId;
    private long capacityBytes;
    private long usedBytes;
    private String lastSeen;
    private String lastHeartbeat;
    private Object labels;
    private String status;
    private double usageRatio;
    private long availableBytes;

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getFileTotal() {
        return fileTotal;
    }

    public void setFileTotal(int fileTotal) {
        this.fileTotal = fileTotal;
    }

    public int getCapacity() {
        return capacity;
    }

    public void setCapacity(int capacity) {
        this.capacity = capacity;
    }

    public int getUseCapacity() {
        return useCapacity;
    }

    public void setUseCapacity(int useCapacity) {
        this.useCapacity = useCapacity;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
        // 如果host为空，则使用ip作为host
        if (this.host == null || this.host.isEmpty()) {
            this.host = ip;
        }
    }

    public long getUsedCapacity() {
        return usedCapacity;
    }

    public void setUsedCapacity(long usedCapacity) {
        this.usedCapacity = usedCapacity;
        // 兼容旧字段
        this.useCapacity = (int) usedCapacity;
    }

    public long getTotalCapacity() {
        return totalCapacity;
    }

    public void setTotalCapacity(long totalCapacity) {
        this.totalCapacity = totalCapacity;
        // 兼容旧字段
        this.capacity = (int) totalCapacity;
    }

    public int getFileNum() {
        return fileNum;
    }

    public void setFileNum(int fileNum) {
        this.fileNum = fileNum;
        // 兼容旧字段
        this.fileTotal = fileNum;
    }

    public String getDsId() {
        return dsId;
    }

    public void setDsId(String dsId) {
        this.dsId = dsId;
    }

    public long getCapacityBytes() {
        return capacityBytes;
    }

    public void setCapacityBytes(long capacityBytes) {
        this.capacityBytes = capacityBytes;
        // 兼容旧字段
        this.totalCapacity = capacityBytes;
        this.capacity = (int) capacityBytes;
    }

    public long getUsedBytes() {
        return usedBytes;
    }

    public void setUsedBytes(long usedBytes) {
        this.usedBytes = usedBytes;
        // 兼容旧字段
        this.usedCapacity = usedBytes;
        this.useCapacity = (int) usedBytes;
    }

    public String getLastSeen() {
        return lastSeen;
    }

    public void setLastSeen(String lastSeen) {
        this.lastSeen = lastSeen;
    }

    public String getLastHeartbeat() {
        return lastHeartbeat;
    }

    public void setLastHeartbeat(String lastHeartbeat) {
        this.lastHeartbeat = lastHeartbeat;
    }

    public Object getLabels() {
        return labels;
    }

    public void setLabels(Object labels) {
        this.labels = labels;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public double getUsageRatio() {
        return usageRatio;
    }

    public void setUsageRatio(double usageRatio) {
        this.usageRatio = usageRatio;
    }

    public long getAvailableBytes() {
        return availableBytes;
    }

    public void setAvailableBytes(long availableBytes) {
        this.availableBytes = availableBytes;
    }

    @Override
    public String toString() {
        return "DataServerMsg{" +
                "dsId='" + dsId + '\'' +
                ", host='" + host + '\'' +
                ", port=" + port +
                ", ip='" + ip + '\'' +
                ", status='" + status + '\'' +
                ", capacityBytes=" + capacityBytes +
                ", usedBytes=" + usedBytes +
                ", availableBytes=" + availableBytes +
                ", usageRatio=" + usageRatio +
                ", lastSeen='" + lastSeen + '\'' +
                ", lastHeartbeat='" + lastHeartbeat + '\'' +
                '}';
    }
}
